﻿using System;

namespace Communication.Message.Buffer
{
	// Token: 0x02000036 RID: 54
	internal class HeapMessageBufferFactory : AbstractMessageBufferFactory
	{
		// Token: 0x06000192 RID: 402 RVA: 0x000051B7 File Offset: 0x000033B7
		public static MessageBufferFactory GetInstance()
		{
			return HeapMessageBufferFactory.INSTANCE_BE;
		}

		// Token: 0x06000193 RID: 403 RVA: 0x000051BE File Offset: 0x000033BE
		public static MessageBufferFactory GetInstance(ByteOrder endianness)
		{
			if (endianness == ByteOrder.BIG_ENDIAN)
			{
				return HeapMessageBufferFactory.INSTANCE_BE;
			}
			if (endianness == ByteOrder.LITTLE_ENDIAN)
			{
				return HeapMessageBufferFactory.INSTANCE_LE;
			}
			throw new ArgumentException();
		}

		// Token: 0x06000194 RID: 404 RVA: 0x000051D8 File Offset: 0x000033D8
		public HeapMessageBufferFactory()
		{
		}

		// Token: 0x06000195 RID: 405 RVA: 0x000051E0 File Offset: 0x000033E0
		public HeapMessageBufferFactory(ByteOrder defaultOrder) : base(defaultOrder)
		{
		}

		// Token: 0x06000196 RID: 406 RVA: 0x000051E9 File Offset: 0x000033E9
		public override MessageBuffer GetBuffer(ByteOrder order, int capacity)
		{
			return MessageBuffers.Buffer(order, capacity);
		}

		// Token: 0x04000065 RID: 101
		private static readonly HeapMessageBufferFactory INSTANCE_BE = new HeapMessageBufferFactory(ByteOrder.BIG_ENDIAN);

		// Token: 0x04000066 RID: 102
		private static readonly HeapMessageBufferFactory INSTANCE_LE = new HeapMessageBufferFactory(ByteOrder.LITTLE_ENDIAN);
	}
}
